<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    // ES5 
    var name = "张三";
    var age = 18;
    var weight = "70kg";
    var height = "178cm";

    var zhang = {
        "name": name,
        age: age,
        weight: weight,
        height: height,
        say: function () {
            console.log(this.name, this.age);
        }

    };
    console.log(zhang);

    // ES6 对象简写
    // (1) 对象的键名 和 键值对应的变量名 相同时  键名可以简写  (前提: 变量作为对象的属性值)
    // (2) ES6函数可以简写

    var zhang = {
        name,
        age,
        weight,
        height,
        say() {
            console.log(this.name, this.age);
        }
    }
    console.log(zhang);
    zhang.say();







</script>

</html>